'use strict';

module.exports = app => {
    class CommentController extends app.Controller {


        //获取评论详情（资讯）
        async replaylist() {
            const params = this.ctx.request.query;
            const data1 = await this.service.comment.getCommentDetail(params);
            const review = await this.service.comment.getReview(params);
            this.app.logger.info(data1);
            //获取根据编号获取回评
            this.app.logger.info(review);
            await this.ctx.render("/comment/replay-list.html", {data1,review});
        };


        //回评评论（资讯）
        async onereviewsend(){
            const params = this.ctx.request.body;
            const review = await this.service.comment.oneReviewSend(params);
            this.app.logger.info(review);
            this.success();
        };

        //获取评论详情(社区)
        async postreplaylist(){
            const params = this.ctx.request.query;
            const data1 = await this.service.comment.getPostrePlayList(params);
            const review = await this.service.comment.getPostReview(params);
            await this.ctx.render("/comment/post-replay-list.html",{data1,review});
        };

        //回评评论(社区)
        async towreviewsend(){
            const params = this.ctx.request.body;
            const review = await this.service.comment.towReviewSend(params);
            this.app.logger.info(review);
            this.success();
        };
    }
    return CommentController;
};

